package com.skycode.servlet;

import com.skycode.bean.NewsBean;
import com.skycode.dao.NewsDao;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/noticedetail.html")
public class NoticeDateServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String NewsID = req.getParameter("NoticeId");
        int id = Integer.parseInt(NewsID);
        NewsBean newsBean = (new NewsDao()).getOne(id);
        req.setAttribute("title", newsBean.getNewsTitle());
        req.setAttribute("content", newsBean.getNewsContent());
        req.getRequestDispatcher("newsFrontDetail.jsp").forward(req, resp);
    }
}
